\testfile{pgfplotstest.errorbars.tex}
\testsection{Errorbars}
{
%\tracingmacros=2\tracingcommands=2
\starttikzpicture
\startaxis
\addplot plot[
	/pgfplots/error bars/.cd,
	y dir=both,y explicit,
	x dir=both,x fixed relative=0.5,
	error mark=diamond*,
]
	coordinates
	{(0,0) +- (0.5,0.1)
	(0.1,0.1)  +- (0.05,0.2)
	(0.2,0.2) 	+- (0,0.05)
	(0.5,0.5)
	(1,1)};
\stopaxis
\stoptikzpicture

\testsubsubsection{changing styles}
\starttikzpicture
\startaxis
\addplot plot[
	/pgfplots/error bars/.cd,
	y dir=plus,y explicit,
	error bar style={black,dotted,/pgfplots/error bars/error mark=square*,/pgfplots/error bars/error mark options={current plot style}},
]
	coordinates
	{(0,0) +- (0.5,0.1)
	(0.1,0.1)  +- (0.05,0.2)
	(0.2,0.2) 	+- (0,0.05)
	(0.5,0.5) +- (0.1,0.2)
	(1,1) +- (0.3,0.1)
	};
\stopaxis
\stoptikzpicture

\testsubsubsection{using 100\% minus}
\starttikzpicture
\startaxis
\addplot plot[
	/pgfplots/error bars/.cd,
	y dir=minus,y fixed relative=1,
	x dir=minus,x fixed relative=1,
	error mark=none,
	error bar style={dotted},
]
	coordinates
	{(0,0)
	(0.1,0.1)
	(0.2,0.2) 	
	(0.5,0.5)
	(1,1)
	};
\stopaxis
\stoptikzpicture
%
\testsubsubsection{with plot table}
%\lstinputlisting{plotdata/pgfplotstest_plot}

\starttikzpicture
\startaxis[title={maxlevel versus cgiter, table~\ref{tbl:k}}]
\addplot plot[
	/pgfplots/error bars/.cd,
	y dir=both,y explicit,
] table[x=maxlevel,y=cgiter,y error=cgiter_err] {plotdata/pgfplotstest_plot.dat};

\stopaxis
\stoptikzpicture

\testsubsection{Log-plot}
\testsubsubsection{relative errors}
\starttikzpicture
\startloglogaxis[
	grid=both]
\addplot plot[
	/pgfplots/error bars/.cd,
	y dir=both,y explicit relative,
	x dir=both,x fixed relative=0.5,
	error mark=triangle*,
]
	coordinates {
		(32,32)
		(64,64)
		(128,128) +- (0,0.3)
		(1024,1024) +- (0,0.2)
		(32068,32068)  +- (0,0.6)
		(64000,64000) +- (0,0.6)
		(128000,128000) +- (0,0.6)
	};

\stoploglogaxis
\stoptikzpicture

\testsubsubsection{x fixed=500, y explicit relative}
\starttikzpicture
\startloglogaxis[
	grid=both]
\addplot plot[
	/pgfplots/error bars/.cd,
	y dir=both,y explicit relative,
	x dir=both,x fixed=500,
	error mark=triangle*,
]
	coordinates {
		(32,32)
		(64,64)
		(128,128) +- (0,0.3)
		(1024,1024) +- (0,0.2)
		(32068,32068)  +- (0,0.6)
		(64000,64000) +- (0,0.6)
		(128000,128000) +- (0,0.6)
	};

\stoploglogaxis
\stoptikzpicture

\testsubsubsection{with plot table}
\starttikzpicture
\startloglogaxis[title={dof versus Lmax, table~\ref{tbl:k}}]
\addplot plot[
	/pgfplots/error bars/.cd,
	y dir=both,y explicit relative,
] table[x=dof,y=Lmax,y error=Lmax_relerror] {plotdata/pgfplotstest_plot.dat};
\stoploglogaxis
\stoptikzpicture

\testsubsubsection{with plot table absolute}
\starttikzpicture
\startloglogaxis[grid=both,title={dof versus L2, table~\ref{tbl:k}}]
\addplot plot[
	/pgfplots/error bars/.cd,
	y dir=both,y explicit,
] table[x=dof,y=L2,y error=L2_abserror] {plotdata/pgfplotstest_plot.dat};
\stoploglogaxis
\stoptikzpicture
}
